<template>
  <el-drawer
    title="订单详情"
    :visible.sync="isShow"
    :wrapper-closable="!modalDialog"
    size="1000px"
  >
    <div class="property-title">订单信息</div>
    <div class="df_ac">
      <div class="item" style="width: 66.66%;">
        <span class="key">订单编号：</span>
        <span class="value">{{ detail.orderId || detail.id }}</span>
      </div>
      <div class="item">
        <span class="key">订单状态：</span>
        <span>{{ detail.statusName }}</span>
      </div>
      <div class="item">
        <span class="key">创建时间：</span>
        <span class="value">{{ detail.createDate }}</span>
      </div>
      <div class="item">
        <span class="key">支付时间：</span>
        <span class="value">{{ detail.payDate || '-' }}</span>
      </div>
      <div class="item">
        <span class="key">订单金额：</span>
        <span class="value">{{ detail.money }}积分</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">买家信息</div>
    <div class="df_ac mt20">
      <div>
        <span class="key">姓名：</span>
        <span class="value">{{ detail.buyer.memberName || '-' }}</span>
      </div>
      <div>
        <span class="key">联系电话：</span>
        <span class="value">{{ detail.buyer.phone || '-' }}</span>
      </div>
      <div>
        <span class="key">会员卡号：</span>
        <span class="value">{{ detail.buyer.memberCardNo || '-' }}</span>
      </div>
    </div>
    <template v-if="detail.ztObj && detail.ztObj.pickUpAddress">
      <div class="line-style mb20" />
      <div class="property-title">自提信息</div>
      <div class="df_ac mt20">
        <div>
          <span class="key">取货码：</span>
          <span class="value">{{ detail.ztObj.claimCode || '-' }}</span>
        </div>
        <div>
          <span class="key">操作人：</span>
          <span class="value">{{ detail.ztObj.operator || '-' }}</span>
        </div>
        <div>
          <span class="key">提货地址：</span>
          <span class="value">{{ detail.ztObj.pickUpAddress || '-' }}</span>
        </div>
        <div>
          <span class="key">提货时间：</span>
          <span class="value">{{ detail.ztObj.pickUpTime || '-' }}</span>
        </div>
      </div>
    </template>
    <template v-if="detail.kdObj && detail.kdObj.receiverAddress">
      <div class="line-style mb20" />
      <div class="property-title">快递信息</div>
      <div class="df_ac mt20">
        <div>
          <span class="key">收货人：</span>
          <span class="value">{{ detail.kdObj.receiverName || '-' }}</span>
        </div>
        <div>
          <span class="key">联系电话：</span>
          <span class="value">{{ detail.kdObj.receiverPhone || '-' }}</span>
        </div>
        <div>
          <span class="key">收货地址：</span>
          <span class="value">{{ detail.kdObj.receiverAddress || '-' }}</span>
        </div>
        <div>
          <span class="key">快递公司：</span>
          <span class="value">{{ detail.kdObj.kdCompany || '-' }}</span>
        </div>
        <div>
          <span class="key">快递单号：</span>
          <span class="value">{{ detail.kdObj.kdNo || '-' }}</span>
        </div>
        <div>
          <span class="key">发货时间：</span>
          <span class="value">{{ detail.kdObj.sendTime || '-' }}</span>
        </div>
      </div>
    </template>
    <div class="property-title">商品信息</div>
    <el-table
      :data="detail.goodsList"
      border
      fit
      :header-row-class-name="'table-header'"
      class="doumee-element-table"
    >
      <el-table-column
        align="center"
        label="商品名称"
        prop="goodsName"
        min-width="120"
        show-overflow-tooltip
      />
      <el-table-column
        align="center"
        label="数量"
        prop="num"
        min-width="100"
        show-overflow-tooltip
      />
      <el-table-column
        align="center"
        label="兑换积分"
        prop="integral"
        min-width="100"
        show-overflow-tooltip
      />
    </el-table>
  </el-drawer>
</template>

<script>
import store from '@/store'
import { integralOrderDetail } from '@/api'
export default {
  data() {
    return {
      isShow: false,
      detail: {},
      modalDialog: store.getters.dialog
    }
  },
  methods: {
    getOrderDetail(id) {
      this.detail = {}
      integralOrderDetail({ param: { id }}).then(res => {
        if (res.errorCode === '000000') {
          this.detail = { ...res.record }
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.df_ac {
  flex-wrap: wrap;
  div {
    width: 33.33%;
    margin-bottom: 20px;
    .key {
  color: #666666;
  display: inline-block;
  // width: 90px;
  // text-align: right;
}
.value {
  color: #222;
}
  }
}
.bottom_wrap {
  margin-top: 30px;
  text-align: right;
  .line {
    margin-bottom: 10px;
  }
}
</style>
